<!DOCTYPE html>
<html lang="zh-cn">
<head>
    {{template "widgets/head.html" .}}
        <style>
            h3{font-weight: normal;margin-bottom: 20px;font-size: 20px;margin-top: 15px;}
            .bind-options label{font-weight: normal;margin-right: 8px;cursor: pointer;}
        </style>
</head>
<body class="manual-container">
<header class="navbar navbar-static-top smart-nav navbar-fixed-top manual-header" role="banner">
    <div class="container">
        <div class="navbar-header col-sm-12 col-md-6 col-lg-5">
            <a href="/" class="navbar-brand" title="{{.SITE_NAME}}">
                <img class="logo" src="/static/images/logo.png" alt="{{.SITE_NAME}}">
            </a>
        </div>
    </div>
</header>
<div class="container manual-body">
    <div class="row login">
        <div class="col-xs-12">
                <div class="login-body">
                        <form role="form" class="ajax-form" data-url="{{urlfor "HomeController.Index"}}" action="{{urlfor "AccountController.Bind"}}" method="post">
                            <h3>{{if .IsEmail}}用户注册{{else}}完善资料{{end}} <small class="pull-right text-muted">{{.Tips}}</small></h3>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">&nbsp;用 户 名</div>
                                    <input type="text" class="form-control" name="account" placeholder="由英文字母数字组成，限3-50个字符" id="account" value="{{.Username}}" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon">登录密码</div>
                                    <input type="password" class="form-control" placeholder="密码必须在6-50个字符之间" name="password1" id="password1" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group has-hidden">
                                <div class="input-group">
                                    <div class="input-group-addon">确认密码</div>
                                    <input type="password" class="form-control" placeholder="密码必须在6-50个字符之间" name="password2" id="password2" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group has-hidden">
                                <div class="input-group">
                                    <div class="input-group-addon">用户昵称</div>
                                    <input type="text" class="form-control" name="nickname" id="nickname" value="{{.Nickname}}" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group has-hidden">
                                <div class="input-group">
                                    <div class="input-group-addon">用户邮箱</div>
                                    <input type="email" class="form-control" name="email" id="email" value="{{.Email}}" autocomplete="off">
                                </div>
                            </div>
                            <input type="hidden" name="avatar" value="{{.Avatar}}">
                            <input type="hidden" name="id" value="{{.Id}}">
                            <input type="hidden" name="oauth" value="{{.AuthType}}">
                            {{if eq .IsEmail false}}
                                <div class="form-group bind-options">
                                    <label><input type="radio" name="isbind" checked value="0"> 注册新账号</label>
                                    <label><input type="radio" name="isbind" value="1"> 绑定已有账号</label>
                                </div>
                            {{else}}
                                {{if .CaptchaOn}}
                                    <div class="form-group">
                                        <div class="input-group">
                                            <div class="input-group-addon">
                                                &nbsp;验 证 码&nbsp;
                                            </div>
                                            <input type="text" class="form-control" placeholder="验证码" name="captcha" autocomplete="off">
                                        </div>
                                    </div>
                                {{create_captcha}}
                                {{end}}
                            {{end}}

                            <div class="form-group mgt-15px">
                                <button type="submit" class="btn btn-success btn-block" data-has="绑定已有账号" data-not="注册新账号">注册新账号</button>
                            </div>

                            <div class="help-block">
                                 {{if $.OauthLogin}}使用以下方式一键登录{{end}}
                                 <span class="pull-right"> 已有账号？ <a href="{{urlfor "AccountController.Login"}}" title="立即登录" class="tooltips text-primary">立即登录</a></span>
                            </div>
                            <div class="form-group login-by-third">
                                {{if $.LoginQQ}}
                                <a class="tooltips" href="https://graph.qq.com/oauth2.0/authorize?client_id={{.QQClientId}}&redirect_uri={{.QQCallback}}&response_type=code&state=bookstack.cn{{.RandomStr}}" rel="nofollow" title="使用QQ一键登录">
                                    <img src="/static/images/qq.png" alt="QQ">
                                </a>
                                {{end}}
                                {{if $.LoginGitHub}}
                                <a class="tooltips" href="https://github.com/login/oauth/authorize?client_id={{.GithubClientId}}&redirect_uri={{.GithubCallback}}" rel="nofollow" title="使用GitHub一键登录">
                                    <img src="/static/images/github.png" alt="GitHub">
                                </a>
                                {{end}}
                                {{if $.LoginGitee}}
                                <a class="tooltips" rel="nofollow" title="使用码云(Gitee)一键登录" href="https://gitee.com/oauth/authorize?client_id={{.GiteeClientId}}&redirect_uri={{.GiteeCallback}}&response_type=code">
                                    <img src="/static/images/gitee.png" alt="码云(Gitee)">
                                </a>
                                {{end}}
                            </div>
                        </form>
                    </div>
        </div>
        
    </div>
    <div class="clearfix"></div>
</div>
{{/*<script src="/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>*/}}
<script src="/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
{{/*<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>*/}}
<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/js/toast.script.js" type="text/javascript"></script>
<script src="/static/js/main.js?version={{$.Version}}" type="text/javascript"></script>
{{/*js直接写在这里了*/}}
<script>$(function () {
    $(".bind-options label").click(function () {
        var options=$(this);
        $.each(options,function () {
            if($(this).find("input").prop("checked")==true){
                var btnSubmit=$("form [type=submit]");
                if ($(this).find("input").val()==1){//绑定已有账号
                    $(".has-hidden").hide();
                    btnSubmit.text(btnSubmit.attr("data-has"));
                }else{//注册新账号
                    $(".has-hidden").show();
                    btnSubmit.text(btnSubmit.attr("data-not"));
                }
            }
        })
    })
})</script>
</body>
</html>